#pragma once

#include "Angel.h"
#include "HSBlueprints.h"
#include <vector>
#include <string.h>

#define theLevel HSLevel::GetInstance()

class HSTileActor : public Actor
{
protected:

	const HSTile* pTile;

public:

	static const int iGroundLevel = -10000;
	
	HSTileActor();

	bool Create( const HSTile* pT, float fpX, float fpY );

	const std::string& GetTileId() const;
};

class HSObjectActor : public Actor
{
protected:

	const HSObject* pObj;
	
public:

	int	iObjLayer;
	
	HSObjectActor();

	bool Create( const HSObject* pO, float fpX, float fpY );

	void SetObjectLayer();
	const std::string& GetActionType();
	const std::string& GetActionArg();
	const std::string& GetObjectId() const;
};

class HSLevel : public MouseListener
{
protected:

	static HSLevel* sLevel;

	bool bLoaded;
	bool bActive;

	std::vector< HSTileActor* > vctGround;
	std::vector< HSObjectActor* > vctObjects;

	float fWorldToPixel;
	float fPixelToWorld;

	void MouseMotionEvent(Vec2i screenCoordinates); 
	void MouseDownEvent(Vec2i screenCoordinates, MouseButtonInput button); 
	void MouseUpEvent(Vec2i screenCoordinates, MouseButtonInput button); 
	void MouseWheelEvent(const Vector2 &scrollOffset);

public:

	HSLevel();
	~HSLevel();

	bool Load( const std::string& sLevelFile );
	void Unload();

	void Activate();
	void Deactivate();

	static HSLevel& GetInstance();
};
